
//public class PlayerInput : MonoBehaviour {

	var speed : float = 6.0f;
	var jumpSpeed : float = 8.0f;
	var gravity : float = 20.0f;
	
	private var moveDirection : Vector3 = Vector3.zero;
//	private bool grounded = false;

	
	// Use this for initialization
	function Start () {
		
		
	
	}
	
	// Update is called once per frame
	function Update () {
	
		
		var control : CharacterController = GetComponent (CharacterController);
		if(control.isGrounded)
		{
			moveDirection = Vector3(Input.GetAxis("Horizontal"),0,0);
			moveDirection *= speed;
		
		
		if(moveDirection.sqrMagnitude > 0.01)
		{
			transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(moveDirection), 1);
		}
		
		if(Input.GetButton("Jump"))
			{
				moveDirection.y = jumpSpeed;
			}
			
		}
		
		moveDirection.y -= gravity * Time.deltaTime;
		
		control.Move(moveDirection * Time.deltaTime);
	
		
	}

